//
//  ZLGameViewController.m
//  LittleFairyPoet
//
//  Created by rimi on 15/9/8.
//  Copyright (c) 2015年 周林. All rights reserved.
//

#import "ZLGameViewController.h"
#import "LXGGeneralModelViewController.h"
#import "LXGChallengeModelViewController.h"

@interface ZLGameViewController ()

@property (nonatomic, strong) UIButton *backButton; /**< 返回 */
@property (nonatomic, strong) UIImageView *backgroundImage; /**< 背景图 */
@property (nonatomic, strong) UIImageView *titleImage; /**< 标题图案 */
@property (nonatomic, strong) UIButton *hormButton; /**< 喇叭 */
@property (nonatomic, strong) UIButton *generalModel; /**< 普通模式 */
@property (nonatomic, strong) UIButton *challengeModel; /**< 挑战模式 */

- (void)initializeDataSource; /**< 初始化数据源 */
- (void)initializeUserInterface; /**< 初始化用户界面 */

@end

@implementation ZLGameViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initializeDataSource];
    [self initializeUserInterface];
}
#pragma mark - private
- (void)initializeDataSource {
    
}

- (void)initializeUserInterface {
    self.view.backgroundColor = [UIColor whiteColor];
    self.leftButton.hidden = YES;
    self.titleLable.hidden = YES;
    [self.view addSubview:self.backgroundImage];
    [self.view addSubview:self.backButton];
    [self.view addSubview:self.titleImage];
    [self.view addSubview:self.hormButton];
    [self.view addSubview:self.generalModel];
    [self.view addSubview:self.challengeModel];
}

#pragma mark - action
- (void)action_backButton:(UIButton *)sender {
    
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)action_hormButton:(UIButton *)sender {
    sender.selected = !sender.selected;
}

- (void)action_generalButton:(UIButton *)sender {
    LXGGeneralModelViewController *general_vc = [[LXGGeneralModelViewController alloc] init];
    [self.navigationController pushViewController:general_vc animated:YES];
}

- (void)action_challengeButton:(UIButton *)sender {
    
}

#pragma mark - getter
- (UIButton *)backButton {
    if (!_backButton) {
        _backButton = ({
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = DHFlexibleFrame(CGRectMake(15, 24, 60, 60), YES);
            [button setImage:IMAGE_CONTENT(@"返回_iphone.png") forState:UIControlStateNormal];
            [button addTarget:self action:@selector(action_backButton:) forControlEvents:UIControlEventTouchUpInside];
            button;
        });
    }
    return _backButton;
}

- (UIImageView *)backgroundImage {
    if (!_backgroundImage) {
        _backgroundImage = ({
            UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, ORIGIN_WIDTH, ORIGIN_HEIGHT) adjustWidth:YES];
            imageView.image = IMAGE_CONTENT(@"background_game.jpg");
            imageView;
        });
    }
    return _backgroundImage;
}

- (UIImageView *)titleImage {
    if (!_titleImage) {
        _titleImage = ({
            UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(70, 24, 180, 50) adjustWidth:YES];
            imageView.image = IMAGE_CONTENT(@"title3.png");
            imageView;
        });
    }
    return _titleImage;
}

- (UIButton *)hormButton {
    if (!_hormButton) {
        _hormButton = ({
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = DHFlexibleFrame(CGRectMake(ORIGIN_WIDTH - 40, 30, 30, 30), YES);
            [button setImage:IMAGE_CONTENT(@"声音_开.png") forState:UIControlStateNormal];
            [button setImage:IMAGE_CONTENT(@"声音_关.png") forState:UIControlStateSelected];
            [button.imageView setTintColor:ZLColor(204, 102, 0)];
            [button addTarget:self action:@selector(action_hormButton:) forControlEvents:UIControlEventTouchUpInside];
            button;
        });
    }
    return _hormButton;
}

- (UIButton *)generalModel {
    if (!_generalModel) {
        _generalModel = ({
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = DHFlexibleFrame(CGRectMake(80, 180, 150, 60), YES);
            [button setImage:IMAGE_CONTENT(@"普通模式.png") forState:UIControlStateNormal];
            [button addTarget:self action:@selector(action_generalButton:) forControlEvents:UIControlEventTouchUpInside];
            button;
        });
    }
    return _generalModel;
}

- (UIButton *)challengeModel {
    if (!_challengeModel) {
        _challengeModel = ({
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = DHFlexibleFrame(CGRectMake(80, 260, 150, 60), YES);
            [button setImage:IMAGE_CONTENT(@"挑战模式.png") forState:UIControlStateNormal];
            [button addTarget:self action:@selector(action_challengeButton:) forControlEvents:UIControlEventTouchUpInside];
            button;
        });
    }
    return _challengeModel;
}

- (BOOL)prefersStatusBarHidden {
    return YES;
}

@end
